# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=bt_audit
pkgver=0.1.1
pkgrel=5
groups=('blackarch' 'blackarch-bluetooth' 'blackarch-fuzzer')
pkgdesc="Bluetooth audit"
url='http://www.betaversion.net/btdsd/download/'
depends=('bluez-libs')
arch=('x86_64' 'aarch64')
license=('GPL')
conflicts=('bt-audit' 'btaudit')
provides=('bt-audit' 'btaudit')
replaces=('bt-audit' 'btaudit')
source=("http://www.betaversion.net/btdsd/download/$pkgname-$pkgver.tar.gz")
sha512sums=('665e22fa3ec8220a63795e67dceb412274b79c9620b1b4a5e4d56254677882ba54c8c0c8b1530ffc916baf8456bee300fe784938182aeb0f8143a4c18f0115a5')

prepare() {
  cd "$pkgname/src"

  sed -i "s:gcc :gcc $CFLAGS :" Makefile
}

build() {
  cd "$pkgname/src"

  make
}

package() {
  cd "$pkgname/src"

  install -Dm 755 psm_scan "$pkgdir/usr/bin/psm_scan"
  install -Dm 755 rfcomm_scan "$pkgdir/usr/bin/rfcomm_scan"

  cd ..

  install -Dm 644 README "$pkgdir/usr/share/$pkgname/README"
  install -Dm 755 scripts/btdsd_sample.sh \
    "$pkgdir/usr/share/$pkgname/scripts/btdsd_sample.sh"
}

